﻿using CommonFunction;
using MyWPF.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace MyWPF.StaticData
{
    public class StaticInfo
    {
        /// <summary>
        /// config结构会保存到json
        /// </summary>
        public Config config = new Config();
    }
    public class Config
    {
        public NomalConfig NomalConfig { get; set; }

        public VersionConfig VersionConfig { get; set; }

        public JournalConfig JournalConfig { get; set; }
    }
    public class NomalConfig
    {
        /// <summary>
        /// 项目开机自动启动
        /// </summary>
        public bool AutoStart
        {
            get
            {
                return _autoStart;
            }
            set
            {
                _autoStart = value;
            }
        }
        [JsonIgnore]
        private bool _autoStart;

        /// <summary>
        /// 禁止多启动
        /// </summary>
        public bool BanMore
        {
            get
            {
                return _banMore;
            }
            set
            {
                _banMore = value;
            }
        }
        [JsonIgnore]
        private bool _banMore;

        /// <summary>
        /// 项目语言
        /// </summary>
        public Language Language
        {
            get
            {
                return _language;
            }
            set
            {
                _language = value;
            }
        }
        [JsonIgnore]
        private Language _language;




        /// <summary>
        /// 项目主体颜色
        /// </summary>
        public SolidColorBrush MainColor
        {
            get
            {
                return _mainColor;
            }
            set
            {
                _mainColor = value;
                StaticModels.vM_Login.MainColor = value;
                StaticModels.vM_JournalSet.MainColor = value;
                StaticModels.vM_JournalPage.MainColor = value;
                StaticModels.vM_MotifyRecipe.MainColor = value;
                StaticModels.vM_Recipe.MainColor = value;
                StaticModels.vM_MainWindow.MainColor = value;
                StaticModels.vM_PCState.MainColor = value;
                StaticModels.vM_MainPage.MainColor = value;
                StaticModels.vM_MainPage_Son3.MainColor = value;
                StaticModels.vM_SetWindow.MainColor = value;
                StaticModels.vM_SetWindow_Normal.MainColor = value;
                StaticModels.vM_SetWindow_OPC.MainColor = value;
                StaticModels.vM_UserWindow.MainColor = value;
                StaticModels.vM_UserWindow_Login.MainColor = value;
                StaticModels.vM_UserWindow_AddUser.MainColor = value;
                StaticModels.vM_UserWindow_ModifyUser.MainColor = value;
                StaticModels.vM_CurvePage.MainColor = value;
            }
        }
        [JsonIgnore]
        private SolidColorBrush _mainColor;
        /// <summary>
        /// 项目主体淡色
        /// </summary>
        public SolidColorBrush LightColor
        {
            get
            {
                return _lightColor;
            }
            set
            {
                _lightColor = value;
                StaticModels.vM_Login.LightColor = value;
                StaticModels.vM_JournalSet.LightColor = value;
                StaticModels.vM_JournalPage.LightColor = value;
                StaticModels.vM_MotifyRecipe.LightColor = value;
                StaticModels.vM_Recipe.LightColor = value;
                StaticModels.vM_MainWindow.LightColor = value;
                StaticModels.vM_PCState.LightColor = value;
                StaticModels.vM_MainPage.LightColor = value;
                StaticModels.vM_MainPage_Son3.LightColor = value;
                StaticModels.vM_SetWindow.LightColor = value;
                StaticModels.vM_SetWindow_Normal.LightColor = value;
                StaticModels.vM_SetWindow_OPC.LightColor = value;
                StaticModels.vM_UserWindow.LightColor = value;
                StaticModels.vM_UserWindow_Login.LightColor = value;
                StaticModels.vM_UserWindow_AddUser.LightColor = value;
                StaticModels.vM_UserWindow_ModifyUser.LightColor = value;
                StaticModels.vM_CurvePage.LightColor = value;
            }
        }
        [JsonIgnore]
        private SolidColorBrush _lightColor;
        /// <summary>
        /// 项目文字颜色
        /// </summary>
        public SolidColorBrush FontColor
        {
            get
            {
                return _fontColor;
            }
            set
            {
                _fontColor = value;
                StaticModels.vM_Login.FontColor = value;
                StaticModels.vM_JournalSet.FontColor = value;
                StaticModels.vM_JournalPage.FontColor = value;
                StaticModels.vM_MotifyRecipe.FontColor = value;
                StaticModels.vM_Recipe.FontColor = value;
                StaticModels.vM_MainWindow.FontColor = value;
                StaticModels.vM_PCState.FontColor = value;
                StaticModels.vM_MainPage.FontColor = value;
                StaticModels.vM_MainPage_Son3.FontColor = value;
                StaticModels.vM_SetWindow.FontColor = value;
                StaticModels.vM_SetWindow_Normal.FontColor = value;
                StaticModels.vM_SetWindow_OPC.FontColor = value;
                StaticModels.vM_UserWindow.FontColor = value;
                StaticModels.vM_UserWindow_Login.FontColor = value;
                StaticModels.vM_UserWindow_AddUser.FontColor = value;
                StaticModels.vM_UserWindow_ModifyUser.FontColor = value;
                StaticModels.vM_CurvePage.FontColor = value;
            }
        }
        [JsonIgnore]
        private SolidColorBrush _fontColor;
    }

    public class VersionConfig
    {
        /// <summary>
        /// 版本号
        /// </summary>
        public string Version
        {
            get
            {
                return _version;
            }
            set
            {
                _version = value;
                StaticModels.vM_Login.Version = value;
                StaticModels.vM_UserWindow_Login.Version = value;
                UpdateTime = DateTime.Now;

            }
        }
        [JsonIgnore]
        private string _version;
        /// <summary>
        /// 当前程序更新时间
        /// </summary>
        public DateTime UpdateTime
        {
            get { return _updateTime; }
            set
            {
                _updateTime = value;
            }
        }
        [JsonIgnore]
        private DateTime _updateTime;

        /// <summary>
        /// 项目名称
        /// </summary>
        public string WinCCName
        {
            get
            {
                return _winCCName;
            }
            set
            {
                _winCCName = value;
                StaticModels.vM_Login.WinCCName = value;
                StaticModels.vM_MainWindow.WinCCName = value;
                StaticModels.vM_UserWindow_Login.WinCCName = value;
            }
        }
        [JsonIgnore]
        private string _winCCName;
    }

    public class JournalConfig
    {
        /// <summary>
        /// 一页日志数量
        /// </summary>
        public int OnePageNum
        {
            get
            {
                return _onePageNum;
            }
            set
            {
                StaticModels.vM_JournalSet.OnePageNum = value;
                _onePageNum = value;

            }
        }
        [JsonIgnore]
        private int _onePageNum;
    }

    public enum Language
    {
        中文, English
    }

}
